module.exports = {
	dummyData: function(){
		this.$get = function() {
			var users = [
		    	{id:1, name:"admin", status:1},
		    	{id:2, title:"mirage", status:1}
		  	];
		    return {users: users};
		};
	},
	productService: function(){
		var products = [
		    { id: 0, name: 'Scruff McGruff' },
		    { id: 1, name: 'G.I. Joe' },
		    { id: 2, name: 'Miss Frizzle' },
		    { id: 3, name: 'Ash Ketchum' }
	  	];

	  	return {
		    all: function() {
		      return products;
		    },
		    get: function(productId) {
		      // Simple index lookup
		      return products[productId];
		    }
	  	};
	},
	userService: function($q, dummyData) {
		var users = dummyData.users;
		return {
			get: function(userId){
  				var deferred = $q.defer();

  				var results = users.filter(function(element) {
		        	return parseInt(userId) === element.id;
		      	});
			    
			    deferred.resolve(results);
			    return deferred.promise;
			}
		};
	}
};
